All Questions
26 questions
3votes
2answers
95views
SineCosine Wave
As a beginner this is my first code. Any comments? ...
4votes
2answers
4kviews
Cython with variable-length arrays
Dynamically growing arrays are a type of array. They are very useful when you don't know the exact size of the array at design time. First you need to define an initial number of elements. (Wikipedia) ...
8votes
1answer
130views
Using get_dummies to create a Simple Recommender System - Cold Start
Question: was using get_dummies a good choice for converting categorical strings? I used get_dummies to convert categorical ...
2votes
1answer
91views
Forecasting stock market data using Support Vector Regression
I coded this Support Vector Regression (SVR) myself following some equations in a journal (see here, or here (not in English)). The loss function used by the journal and the code below is mean ...
4votes
0answers
75views
Importer for binary datafile of PI88 Nanoindenter
As an exercise, I want to rewrite a C++ program to import measurement files (and later create excelsheets, reports ...). The measurement files split in 2 files, a binary file, and a xml-file. Because ...
5votes
1answer
601views
Beginning of a GUI Python solution to Andrew Ng's ML week 3 excercises
Coursera has a course for beginning Machine Learning and the code is written in Octave. This is the beginning of a solution to the week 3 exercises but written in python. Instead of a terminal app I'...
1vote
1answer
184views
k-armed bandit problem in Python
I implemented k-armed bandit problem in C#, MATLAB and Python. C# and Matlab code run fairly fast (With same settings of T = 2000 and nRun = 1000 the elapsed time is about 6sec). However, the Python ...
16votes
1answer
406views
Solve the phase state between two haplotype blocks using markov transition probabilities
I have spent about more than a year in python, but I come from biology background. I should say I have got some understanding of for-loop and nested-for-loop to workout the solution to the problem I ...
5votes
1answer
214views
Using NumPy to scale data in 2 out of 3 columns
The below code takes a csv containing age, weight, height and prints the betas determined through linear regression to an output csv. It runs for 10 iterations using a different alpha for each, and ...
5votes
1answer
5kviews
Applying Laplacian smoothing to vertices in a mesh
I'm totally new in Python and I wrote some code. It is a simple algorithm to smooth objects. I need to find adjacent vertices in mesh and sum their coordinates and after that divide by a number of ...
4votes
2answers
342views
Randomly generate a list with predetermined mean
Aim: randomly generate \$n\$ numbers between \$a\$ and \$b\$ with (roughly) mean \$m\$. Problem: The simple beginner's code I wrote becomes very inefficient as \$m\$ moves away from \$\frac{a + b}{2}\...
12votes
3answers
604views
Plotting different parameterized polynoms
For a university assignment I had to plot different polynomial functions depending on one single parameter. That parameter gave the number of supporting points to interpolate a given function in the ...
5votes
1answer
205views
Calculating a table of deBroglie wavelengths for various electron energies
Here is the formula for the deBroglie wavelength of an electron versus its kinetic energy: $$ \lambda(E_k) = h\left/\sqrt{\frac{(E_k+m_eC^2)^2-m_e^2C^4}{C^2}}\right.$$ and here is simple script that ...
6votes
1answer
1kviews
Python! (Snake)
This is now an Iterative Review. Next Iteration Nowhere near a full game yet. Just a basic overview and initialisation of a Snake() class. Thoughts? ...
7votes
1answer
2kviews
Koch snowflake in Python with numpy and pygame
I've drawn a Koch snowflake with Python 3. I'm new to the Python world and would appreciate all feedback on how to make the code more Pythonic as I'm not used to these idioms, styles and modules. All ...